#include using namespace std; int GCF(int x, int y) { int result = x; if(y < x) { result = y; } while(x % result != 0 || y % result != 0) { result--; } return result; } int max(int x, int y) { if(x > y) { return x; } return y; } void referenceExample(int& r) { r = 9; } void Swap(int& y, int& x) { int t = x; x = y; y = t; } void reduceFraction(int& n, int& d) { int gcf = GCF(n,d); n = n/gcf; d = d/gcf; } void main() { //by reference or by value int x = 4; int y = 8; //Swap(x,y); reduceFraction(x,y); cout << x << "/" << y << endl; int& k = x; k = y; k = 7; // referenceExample(y); }